#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;

#define NUMBER_LENGTH 11

int ProcessNumber(char[], int, char);

int main()
{
    char da, db, a[NUMBER_LENGTH], b[NUMBER_LENGTH];
    while (scanf("%s %c %s %c", a, &da, b, &db) != EOF) {
        int a_len = strlen(a), b_len = strlen(b);
        int a_num = ProcessNumber(a, a_len, da),
            b_num = ProcessNumber(b, b_len, db);
        printf("%d\n", a_num + b_num);
    }

    return 0;
}

int ProcessNumber(char x[], int len, char d)
{
    int count = 0, num = d - '0', result = 0;
    for (int i = 0; i < len; i++) 
        if (x[i] == d) 
            count++;
    for (int i = 0; i < count; i++)
        result += pow(10, i) * num;
    
    return result;
}